<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="author" content="wangzhichao">
		<title>商品类型管理</title>
		<script type="text/javascript" language="JavaScript" src="../script/common.js"></script>
		<script type="text/javascript" language="JavaScript" src="../script/tree.js"></script>
		<script type="text/javascript" language="JavaScript">
			var tree;
			var qt = null;
			var org = null;
			function load() {
				Eui.showNavigation();//导航
				showTree();
			}
			/**树**/
			function writeTree() {
				if (tree)
				webTreeHandler.init();
			 	obj = {name:"商品类型",id:null}
				tree = new LoadTree(obj.name,obj.id, "javascript:showProperty()", null, "../images/tree/root.png", "../images/tree/root.png");
				tree.obj = obj;
				$("treeDiv").innerHTML = tree;
			}
			function _startLoadXmlTree(sSrc, jsNode) {
				DWR.call("goodsService.getCategory",sSrc, function(result) {
					_xmlFileLoaded(result, jsNode);
				});
			}
			function _createNode(obj) {
				if(!obj.hasChild){
					node = createTreeNode(false, obj.catName, obj.id, "javascript:showProperty()");
				}else{
					node = createTreeNode(true, obj.catName, obj.id, "javascript:showProperty()", "../images/tree/folder.png", "../images/tree/folder.png");
				}
				node.obj = obj;
				return node;
			}
			function showProperty() {
				var node = tree.getSelected();
				if(node.obj.id){
					onEdit(node.obj.id,true);
				}else{
					onEdit(node.obj.id,false);
				}
			}
			
			//组织机构修改
			function onEdit(id,isshow) {
				if(isshow){
					DWR.call("goodsService.getGoodsCategory",id, function(result) {
						$("detview").style.display = "";
						result.type = Common.getText("goodscategory_type",result.type);
						Common.showDetail("makecardform",result);
						var columns = [];
						columns[0] = {defOrder:"asc"};							
						qt = new QueryTable("sel_gift",null,"datalist",columns, {
							showData:true
						});
						qt.paramFunc = function() {
							return {goodsCategory:id}
						}
					});
				}else{
					$("detview").style.display = "none";
					$("datalist").innerHTML = "";
				}
			}
			//树状模式
			function showTree() {
				$("treemode1").style.display = "";
				writeTree();
			}
		</script>
	</head>
	
	<body onload="load()" class="noScroll">
		<!--页面导航-->
	<div class="nav"><div id="nav">&nbsp;</div></div>
	<table cellSpacing=0 cellPadding=0 width="100%" border=0 height="100%">
		<tr class="treeBody" id="treemode1">
			<td valign="top" width="25%">
				<div class="scrollDiv">
					<div id="treeDiv" class="treeDiv"></div>
				</div>
			</td>
			<td valign="top" align="center" width="75%">
			<div class="detview" id="detview" style="display:none;">
				<form id="makecardform" name="makecardform">
				    <input type="hidden" id="id" name="id">
					<div class=form>
					<div class="formTitle">商品类型明细</div>
						<table cellSpacing=0 cellPadding=4 width="100%" border=0 class="viewTable label6">
							<tr>
								<td><label>商品种类编码</label> <span id="catCode"></span></td>
								<td><label>商品种类名称</label> <span id="catName"></span></td>
							</tr>
							<tr>
								<td><label>类型级别</label> <span id="hierach"></span></td>
								<td>&nbsp;</td>
							</tr>
						</table>
					</div>
				</form>
			</div>
			<div id="datalist"></div>
			</td>
		</tr>
	</table>
	</body>
</html>